

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>The evdev module &mdash; pyamp v1.2 documentation</title>
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '1.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="top" title="pyamp v1.2 documentation" href="../index.html" />
    <link rel="up" title="The input module" href="mod_pyamp_ui_input.html" />
    <link rel="next" title="The userInput module" href="pyamp_ui_input_userInput.html" />
    <link rel="prev" title="The console module" href="pyamp_ui_input_console.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="pyamp_ui_input_userInput.html" title="The userInput module"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="pyamp_ui_input_console.html" title="The console module"
             accesskey="P">previous</a> |</li>
        <li><a href="../index.html">pyamp v1.2 documentation</a> &raquo;</li>
          <li><a href="mod_pyamp.html" >The pyamp module</a> &raquo;</li>
          <li><a href="mod_pyamp_ui.html" >The ui module</a> &raquo;</li>
          <li><a href="mod_pyamp_ui_input.html" accesskey="U">The input module</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-pyamp.ui.input.evdev">
<span id="the-evdev-module"></span><h1>The evdev module<a class="headerlink" href="#module-pyamp.ui.input.evdev" title="Permalink to this headline">¶</a></h1>
<p>evdev.py</p>
<p>This is a Python interface to the Linux input system&#8217;s event device.
Events can be read from an open event file and decoded into spiffy
python objects. The Event objects can optionally be fed into a Device
object that represents the complete state of the device being monitored.</p>
<p>Copyright (C) 2003-2004 Micah Dowty &lt;<a class="reference external" href="mailto:micah&#37;&#52;&#48;navi&#46;cx">micah<span>&#64;</span>navi<span>&#46;</span>cx</a>&gt;</p>
<p>This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.</p>
<p>This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.</p>
<p>You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA</p>
<div class="section" id="the-device-class">
<h2>The Device class<a class="headerlink" href="#the-device-class" title="Permalink to this headline">¶</a></h2>
<p class="graphviz">
<img src="../_images/inheritance-5e4e6789d549052ce88d6e3ec34e033fa7990b77.png" alt="Inheritance diagram of pyamp.ui.input.evdev.Device" usemap="#inheritanceb274c2ffbf" class="inheritance"/>
<map id="inheritanceb274c2ffbf" name="inheritanceb274c2ffbf">
<area shape="rect" href="#pyamp.ui.input.evdev.BaseDevice" title="pyamp.ui.input.evdev.BaseDevice" alt="" coords="5,7,240,33"/>
<area shape="rect" href="../ui.html#pyamp.ui.input.evdev.Device" title="pyamp.ui.input.evdev.Device" alt="" coords="21,84,224,111"/>
</map>
</p>
<dl class="class">
<dt id="pyamp.ui.input.evdev.Device">
<em class="property">class </em><tt class="descclassname">pyamp.ui.input.evdev.</tt><tt class="descname">Device</tt><big>(</big><em>filename</em><big>)</big><a class="reference internal" href="../_modules/pyamp/ui/input/evdev.html#Device"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.ui.input.evdev.Device" title="Permalink to this definition">¶</a></dt>
<dd><p>An abstract input device attached to a Linux evdev device node</p>
<dl class="method">
<dt id="pyamp.ui.input.evdev.Device.poll">
<tt class="descname">poll</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/pyamp/ui/input/evdev.html#Device.poll"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.ui.input.evdev.Device.poll" title="Permalink to this definition">¶</a></dt>
<dd><p>Receive and process all available input events</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.input.evdev.Device.readMetadata">
<tt class="descname">readMetadata</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/pyamp/ui/input/evdev.html#Device.readMetadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.ui.input.evdev.Device.readMetadata" title="Permalink to this definition">¶</a></dt>
<dd><p>Read device identity and capabilities via ioctl()</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.input.evdev.Device.update_EV_ABS">
<tt class="descname">update_EV_ABS</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="../_modules/pyamp/ui/input/evdev.html#Device.update_EV_ABS"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.ui.input.evdev.Device.update_EV_ABS" title="Permalink to this definition">¶</a></dt>
<dd><p>Scale the absolute axis into the range [-1, 1] using absAxisInfo</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="the-basedevice-class">
<h2>The BaseDevice class<a class="headerlink" href="#the-basedevice-class" title="Permalink to this headline">¶</a></h2>
<p class="graphviz">
<img src="../_images/inheritance-98ff5fc0bfc76fa939f57cec2574be743e4d8292.png" alt="Inheritance diagram of pyamp.ui.input.evdev.BaseDevice" usemap="#inheritance3ccd85f8ba" class="inheritance"/>
<map id="inheritance3ccd85f8ba" name="inheritance3ccd85f8ba">
<area shape="rect" href="#pyamp.ui.input.evdev.BaseDevice" title="pyamp.ui.input.evdev.BaseDevice" alt="" coords="5,7,240,33"/>
</map>
</p>
<dl class="class">
<dt id="pyamp.ui.input.evdev.BaseDevice">
<em class="property">class </em><tt class="descclassname">pyamp.ui.input.evdev.</tt><tt class="descname">BaseDevice</tt><a class="reference internal" href="../_modules/pyamp/ui/input/evdev.html#BaseDevice"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.ui.input.evdev.BaseDevice" title="Permalink to this definition">¶</a></dt>
<dd><p>Base class representing the state of an input device, with axes and buttons.
Event instances can be fed into the Device to update its state.</p>
</dd></dl>

</div>
<div class="section" id="the-event-class">
<h2>The Event class<a class="headerlink" href="#the-event-class" title="Permalink to this headline">¶</a></h2>
<p class="graphviz">
<img src="../_images/inheritance-6292fe21c760a9440a36a4db60a9dfc9fe1c5467.png" alt="Inheritance diagram of pyamp.ui.input.evdev.Event" usemap="#inheritancec708fe858b" class="inheritance"/>
<map id="inheritancec708fe858b" name="inheritancec708fe858b">
<area shape="rect" href="../ui.html#pyamp.ui.input.evdev.Event" title="pyamp.ui.input.evdev.Event" alt="" coords="5,7,203,33"/>
</map>
</p>
<dl class="class">
<dt id="pyamp.ui.input.evdev.Event">
<em class="property">class </em><tt class="descclassname">pyamp.ui.input.evdev.</tt><tt class="descname">Event</tt><big>(</big><em>timestamp=0</em>, <em>type=0</em>, <em>code=0</em>, <em>value=0</em>, <em>unpack=None</em>, <em>readFrom=None</em><big>)</big><a class="reference internal" href="../_modules/pyamp/ui/input/evdev.html#Event"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.ui.input.evdev.Event" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents one linux input system event. It can
be encoded and decoded in the &#8216;struct input_event&#8217;
format used by the kernel. Types and codes are automatically
encoded and decoded with the #define names used in input.h</p>
<dl class="method">
<dt id="pyamp.ui.input.evdev.Event.pack">
<tt class="descname">pack</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/pyamp/ui/input/evdev.html#Event.pack"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.ui.input.evdev.Event.pack" title="Permalink to this definition">¶</a></dt>
<dd><p>Pack this event into an input_event struct in
the local machine&#8217;s byte order.</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.input.evdev.Event.readFrom">
<tt class="descname">readFrom</tt><big>(</big><em>stream</em><big>)</big><a class="reference internal" href="../_modules/pyamp/ui/input/evdev.html#Event.readFrom"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.ui.input.evdev.Event.readFrom" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the next event from the given file-like object</p>
</dd></dl>

<dl class="method">
<dt id="pyamp.ui.input.evdev.Event.unpack">
<tt class="descname">unpack</tt><big>(</big><em>s</em><big>)</big><a class="reference internal" href="../_modules/pyamp/ui/input/evdev.html#Event.unpack"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.ui.input.evdev.Event.unpack" title="Permalink to this definition">¶</a></dt>
<dd><p>Unpack ourselves from the given string,, an
input_event struct in the local byte order.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="the-enumdict-class">
<h2>The EnumDict class<a class="headerlink" href="#the-enumdict-class" title="Permalink to this headline">¶</a></h2>
<p class="graphviz">
<img src="../_images/inheritance-52c8171830f9d68d3f3896d4e2a25b75f56da803.png" alt="Inheritance diagram of pyamp.ui.input.evdev.EnumDict" usemap="#inheritance5abb6e1141" class="inheritance"/>
<map id="inheritance5abb6e1141" name="inheritance5abb6e1141">
<area shape="rect" href="#pyamp.ui.input.evdev.EnumDict" title="pyamp.ui.input.evdev.EnumDict" alt="" coords="5,7,229,33"/>
</map>
</p>
<dl class="class">
<dt id="pyamp.ui.input.evdev.EnumDict">
<em class="property">class </em><tt class="descclassname">pyamp.ui.input.evdev.</tt><tt class="descname">EnumDict</tt><big>(</big><em>numberMap</em><big>)</big><a class="reference internal" href="../_modules/pyamp/ui/input/evdev.html#EnumDict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.ui.input.evdev.EnumDict" title="Permalink to this definition">¶</a></dt>
<dd><p>A 1:1 mapping from numbers to strings or other objects, for enumerated
types and other assigned numbers. The mapping can be queried in either
direction. All values, by default, map to themselves.</p>
</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">The evdev module</a><ul>
<li><a class="reference internal" href="#the-device-class">The Device class</a></li>
<li><a class="reference internal" href="#the-basedevice-class">The BaseDevice class</a></li>
<li><a class="reference internal" href="#the-event-class">The Event class</a></li>
<li><a class="reference internal" href="#the-enumdict-class">The EnumDict class</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="pyamp_ui_input_console.html"
                        title="previous chapter">The console module</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="pyamp_ui_input_userInput.html"
                        title="next chapter">The userInput module</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/_generated/pyamp_ui_input_evdev.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="pyamp_ui_input_userInput.html" title="The userInput module"
             >next</a> |</li>
        <li class="right" >
          <a href="pyamp_ui_input_console.html" title="The console module"
             >previous</a> |</li>
        <li><a href="../index.html">pyamp v1.2 documentation</a> &raquo;</li>
          <li><a href="mod_pyamp.html" >The pyamp module</a> &raquo;</li>
          <li><a href="mod_pyamp_ui.html" >The ui module</a> &raquo;</li>
          <li><a href="mod_pyamp_ui_input.html" >The input module</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2012, Brett Ponsler.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.1.
    </div>
  </body>
</html>